Do not output "Blocking - waiting for lock" with -q
authorGeorg Brandl <georg@python.org>
Fri, 26 May 2017 08:07:29 +0000 (10:07 +0200)
committerGeorg Brandl <georg@python.org>
Fri, 26 May 2017 08:07:30 +0000 (10:07 +0200)
This is not an error, so it should not be printed unconditionally
to stderr.  Since it can appear intermittently (e.g. due to editor
integration calling build every now and then) it will disturb
things that expect exact output from cargo (e.g. test suites).

src/cargo/core/shell.rs
src/cargo/util/flock.rs

index 58ed88f3f28174c8b8d50b673902171fd159020f..7ec566ac77d39a4f96062accfca32440c19ebb36 100644 (file)
@@ -90,15 +90,22 @@ impl MultiShell {
         }
     }
 
-    pub fn status<T, U>(&mut self, status: T, message: U) -> CargoResult<()>
+    pub fn status_with_color<T, U>(&mut self, status: T, message: U, color: Color)
+                                   -> CargoResult<()>
         where T: fmt::Display, U: fmt::Display
     {
         match self.verbosity {
             Quiet => Ok(()),
-            _ => self.err().say_status(status, message, GREEN, true)
+            _ => self.err().say_status(status, message, color, true)
         }
     }
 
+    pub fn status<T, U>(&mut self, status: T, message: U) -> CargoResult<()>
+        where T: fmt::Display, U: fmt::Display
+    {
+        self.status_with_color(status, message, GREEN)
+    }
+
     pub fn verbose<F>(&mut self, mut callback: F) -> CargoResult<()>
         where F: FnMut(&mut MultiShell) -> CargoResult<()>
     {
index 64151bff5d5ff3bb6cd96c9606f111d70ac1f0b6..861dd4f735704fe902131d26295127a370bfbfb0 100644 (file)
@@ -288,7 +288,7 @@ fn acquire(config: &Config,
         }
     }
     let msg = format!("waiting for file lock on {}", msg);
-    config.shell().err().say_status("Blocking", &msg, CYAN, true)?;
+    config.shell().status_with_color("Blocking", &msg, CYAN)?;
 
     return block().chain_error(|| {
         human(format!("failed to lock file: {}", path.display()))